/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package persistence;
import persistence.ConnectionFactory;
import model.Usuario;
import java.sql.*;
import java.sql.PreparedStatement;
/**
 *
 * @author Clau
 */
public class UsuarioDAO extends Dao {
    private final Connection connection;
    Long id;
    String nome;
    String cpf;
    String email;
    String telefone;


public UsuarioDAO() {
    this.connection = new ConnectionFactory().getConnection();
}
public void adiciona(Usuario usuario) throws SQLException{

        stmt = con.prepareStatement( "INSERT INTO usuario(nome,senha,email,numMatricula,nivelAcesso) VALUES(?,?,?,?,?)");
        try {
           
                stmt.setString(1, usuario.getNome());
                stmt.setString(2, usuario.getSenha());
                stmt.setString(3, usuario.getEmail());
                stmt.setInt(4, usuario.getNumMatricula());
                stmt.setInt(5, usuario.getNivelAcesso());
                
                stmt.execute();
            

        } catch (SQLException u) {
            throw new RuntimeException(u);
        }
    }
}